<?php
/**
 * Class that operate on table 'album'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2011-11-01 16:06
 */
class AlbumMySqlExtDAO extends AlbumMySqlDAO{

	public function LoadAlbunes(){
		$sql = 'SELECT nombre,id as albumid,
                    (SELECT imagen FROM foto WHERE ( idalbun = album.id ) LIMIT 0 , 1 ) AS imagen,
                    (SELECT Descripcion_Esp FROM foto WHERE ( idalbun = album.id ) LIMIT 0 , 1) as Descripcion_Esp,
                    (SELECT Descripcion_Ing FROM foto WHERE ( idalbun = album.id ) LIMIT 0 , 1) as Descripcion_Ing
                    FROM album WHERE mostrar = 1';
		$sqlQuery = new SqlQuery($sql);
		$tab = $this->execute($sqlQuery);
		$ret = array();
		for($i=0;$i<count($tab);$i++){
			$userContent = new FotosALbunes();
                        $userContent->albumid = $tab[$i]["albumid"];
			$userContent->nombrealbun = $tab[$i]["nombre"];
			$userContent->imagen = $tab[$i]["imagen"];
                        $userContent->des_esp = $tab[$i]["Descripcion_Esp"];
                        $userContent->des_ing = $tab[$i]["Descripcion_Ing"];
			$ret[$i] = $userContent;
		}
		return $ret;
	}
}

class FotosALbunes{
    var $albumid;
    var $nombrealbun;
    var $imagen;
    var $des_esp;
    var $des_ing;

}
?>